package 多线程;

/**
 *
 */
public class JoinMethodTest {

    public volatile static int i = 0;

    private static class AddThread extends Thread {
        @Override
        public void run() {
            for (i = 0; i < 100000000; i++) ;
        }
    }

    public static void main(String[] args) {

        AddThread addThread = new AddThread();
        addThread.start();

        try {
            // 等待该线程执行完毕
            addThread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println(i);
    }

}
